﻿using SimpleNow.Core.Ntiers;
using System.Collections.Generic;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Serialization;
namespace SimpleNow.Core.Localization.Tool
{
    public class LocalizationToolManager : AbstractManager
    {

        public void ExportToXml()
        {
            LocalizationToolDAL myLocalizationToolDAL = new LocalizationToolDAL();
            List<LocalizationLocalizableResourceRecord> myList =  myLocalizationToolDAL.GetResourceByGroupId(3);

            XmlDocument xmlDoc = new XmlDocument();
            XPathNavigator nav = xmlDoc.CreateNavigator();
            using (XmlWriter writer = nav.AppendChild())
            {
                XmlSerializer ser = new XmlSerializer(typeof(List<LocalizationLocalizableResourceRecord>), new XmlRootAttribute("TheRootElementName"));
                ser.Serialize(writer, myList);
            }


            xmlDoc.ToString();

        }
    }
}
